package com.dldata.devtools30.repository.metadata;

import com.dldata.devtools30.entity.DevtModelMetadataFieldEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

@Repository
public interface DevtModelMetadataFieldDao extends com.dldata.devtools30.repository.BaseRepository<DevtModelMetadataFieldEntity,String>, JpaSpecificationExecutor<DevtModelMetadataFieldEntity> {

        @Query("select t from DevtModelMetadataFieldEntity t order by t.xh")
        public List<DevtModelMetadataFieldEntity> getAll();

        @Query("select t from DevtModelMetadataFieldEntity t where t.fieldName like  ?1   order by t.xh")
        public List<DevtModelMetadataFieldEntity> getAll(String serach);

        @Query("select t from DevtModelMetadataFieldEntity t where t.formId=?1   order by t.xh")
        public List<DevtModelMetadataFieldEntity> getAllByTid(String tableid);
        
        @Query("select t from DevtModelMetadataFieldEntity t where t.formId in (?1)   order by t.xh")
        public List<DevtModelMetadataFieldEntity> getAllByTidList(Collection<String> tableidList);

        @Query("select t from DevtModelMetadataFieldEntity t where t.formId=?1  and t.fieldCode <> 'ID' and t.fieldCode <> 'datatime' and t.fieldCode <> 'id'   order by t.xh")
        public List<DevtModelMetadataFieldEntity> getAllByTidNotWhere(String tableid);
        
}
